package com.spzx;

public class MyThread extends Thread{

    static int num = 99;
    @Override
    public synchronized void run() {
        int i = 1;
        while (i<=num){
            System.out.println(currentThread().getName()+"-----"+"第"+i+"个小朋友摘走了第"+i+"个苹果");
            i++;
        }
    }
}
